function vertices = chooseBanks(distances,wanderingDistance,limit,cenLim,varargin);
% Choose where to locate banks

% Strategy 1- low wandering distance to
% Strategy 2 - at least 2 away from center

vertices = [0 0 0];
esize = max(size(distances));
tolerance = limit;
centerTolerance = cenLim;

idw = sum(wanderingDistance);
% now to choose multiple vertices, first one is where closest to target
[dist,indices] = sort(idw);
if (esize == 60)
    center = 18;
else
    center = 23;
end;


for n = 1:esize
    % first we fill the first choice 
    if (vertices(1) == 0)        
        if (distances(indices(n),center) >= centerTolerance)
            vertices(1) = indices(n);
        end;
    % first we fill the second choice
    elseif(vertices(2) == 0)        
        % If it is far away enough
        if(distances(indices(n),vertices(1)) >= tolerance && distances(indices(n),center) >= centerTolerance)
            vertices(2) = indices(n);        
        end;
    % This is our third choice
    elseif (vertices(3) == 0)        
        if(distances(indices(n),vertices(1)) >= tolerance && distances(indices(n),vertices(2)) >= tolerance && distances(indices(n),center) >= centerTolerance)
            vertices(3) = indices(n);        
        end;        
    end;
end;